$OpenBSD: patch-buildtools_wafsamba_samba_install_py,v 1.4 2016/04/25 08:13:41 jca Exp $

- respect OpenBSD shared libraries versioning
- --version-script fails if specified multipled times

--- buildtools/wafsamba/samba_install.py.orig	Thu Dec 10 12:01:40 2015
+++ buildtools/wafsamba/samba_install.py	Sat Apr 23 18:40:25 2016
@@ -117,11 +117,15 @@ def install_library(self):
             else:
                 inst_name    = bld.make_libname(t.target)
         elif self.vnum:
+            import sys
             vnum_base    = self.vnum.split('.')[0]
             install_name = bld.make_libname(target_name, version=self.vnum)
-            install_link = bld.make_libname(target_name, version=vnum_base)
-            inst_name    = bld.make_libname(t.target)
-            if not self.private_library:
+            if sys.platform.startswith('openbsd'):
+                install_link = install_name
+            else:
+                install_link = bld.make_libname(target_name, version=self.vnum)
+            inst_name    = bld.make_libname(t.target, version=self.vnum)
+            if not self.private_library and not sys.platform.startswith('openbsd'):
                 # only generate the dev link for non-bundled libs
                 dev_link     = bld.make_libname(target_name)
         elif getattr(self, 'soname', ''):
@@ -171,7 +175,7 @@ def apply_vscript(self):
     '''add version-script arguments to library build'''
 
     if self.env.HAVE_LD_VERSION_SCRIPT and getattr(self, 'version_script', ''):
-        self.env.append_value('LINKFLAGS', "-Wl,--version-script=%s" %
+        self.env.append_unique('LINKFLAGS', "-Wl,--version-script=%s" %
             self.version_script)
         self.version_script = None
 
